package com.bw.lib_mvicore.ui

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.bw.lib_mvicore.IView

abstract class BaseMviFragment:BaseLazyLoadFragment(), IView {

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        val view= super.onCreateView(inflater, container, savedInstanceState)
        initView()
        return view
    }

    protected open fun initView() {

    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        generateViewModel()
        handleState()
        initData()
    }
    //不需要延迟初始化的数据
    protected open fun initData(){}

    abstract fun generateViewModel()
}